<template>
  <course :drop-course="dropCourse" :curriculum="curriculum" :tip="`退课`"></course>
</template>

<script>
import Course from '@/page/Course'

export default {
  name: "StudentCourse",
  components: {Course},
  data(){
    return{
      curriculum:[]
    }
  },
  methods:{
    dropCourse(course_id) {
      this.curriculum = this.curriculum.filter(course => course.course_id!==course_id)
    }
  },
  mounted() {
    const { student_id } = JSON.parse(localStorage.getItem('userInfo'));
    this.$http
        .get(`${this.$reqPrefix}/getStudentCourse?student_id=${student_id}`)
        .then((res) => {
          this.curriculum = res.data.data || [];
        });
  }
}
</script>

<style scoped>

</style>